<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  
  
  <title>搭建 Hexo | SolarisNeko</title>
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  <meta name="description" content="搭建 Hexo 下载 nodejs  https:&#x2F;&#x2F;nodejs.org&#x2F;zh-cn&#x2F; 下载 git https:&#x2F;&#x2F;git-scm.com&#x2F;  使用 npm 搭建1234567891011121314151617181920# 下载 hexo-clinpm install hexo-cli -g# init hexo 项目hexo init# 安装所有依赖npm install# 清空已有 h">
<meta property="og:type" content="article">
<meta property="og:title" content="搭建 Hexo">
<meta property="og:url" content="https://solarisneko.gitee.io/2021/08/26/SolarisNeko/index.html">
<meta property="og:site_name" content="SolarisNeko">
<meta property="og:description" content="搭建 Hexo 下载 nodejs  https:&#x2F;&#x2F;nodejs.org&#x2F;zh-cn&#x2F; 下载 git https:&#x2F;&#x2F;git-scm.com&#x2F;  使用 npm 搭建1234567891011121314151617181920# 下载 hexo-clinpm install hexo-cli -g# init hexo 项目hexo init# 安装所有依赖npm install# 清空已有 h">
<meta property="og:locale" content="en_US">
<meta property="article:published_time" content="2021-08-26T13:34:41.837Z">
<meta property="article:modified_time" content="2021-08-26T14:32:00.522Z">
<meta property="article:author" content="SolarisNeko">
<meta name="twitter:card" content="summary">
  
    <link rel="alternate" href="/atom.xml" title="SolarisNeko" type="application/atom+xml">
  
  
    <link rel="shortcut icon" href="/favicon.png">
  
  
    
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/typeface-source-code-pro@0.0.71/index.min.css">

  
  
<link rel="stylesheet" href="/css/style.css">

  
    
<link rel="stylesheet" href="/fancybox/jquery.fancybox.min.css">

  
<meta name="generator" content="Hexo 5.4.0"></head>

<body>
  <div id="container">
    <div id="wrap">
      <header id="header">
  <div id="banner"></div>
  <div id="header-outer" class="outer">
    <div id="header-title" class="inner">
      <h1 id="logo-wrap">
        <a href="/" id="logo">SolarisNeko</a>
      </h1>
      
    </div>
    <div id="header-inner" class="inner">
      <nav id="main-nav">
        <a id="main-nav-toggle" class="nav-icon"></a>
        
          <a class="main-nav-link" href="/">Home</a>
        
          <a class="main-nav-link" href="/archives">Archives</a>
        
      </nav>
      <nav id="sub-nav">
        
          <a id="nav-rss-link" class="nav-icon" href="/atom.xml" title="RSS Feed"></a>
        
        <a id="nav-search-btn" class="nav-icon" title="Search"></a>
      </nav>
      <div id="search-form-wrap">
        <form action="//google.com/search" method="get" accept-charset="UTF-8" class="search-form"><input type="search" name="q" class="search-form-input" placeholder="Search"><button type="submit" class="search-form-submit">&#xF002;</button><input type="hidden" name="sitesearch" value="https://solarisneko.gitee.io"></form>
      </div>
    </div>
  </div>
</header>

      <div class="outer">
        <section id="main"><article id="post-SolarisNeko" class="h-entry article article-type-post" itemprop="blogPost" itemscope itemtype="https://schema.org/BlogPosting">
  <div class="article-meta">
    <a href="/2021/08/26/SolarisNeko/" class="article-date">
  <time class="dt-published" datetime="2021-08-26T13:34:41.837Z" itemprop="datePublished">2021-08-26</time>
</a>
    
  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 class="p-name article-title" itemprop="headline name">
      搭建 Hexo
    </h1>
  

      </header>
    
    <div class="e-content article-entry" itemprop="articleBody">
      
        <h1 id="搭建-Hexo"><a href="#搭建-Hexo" class="headerlink" title="搭建 Hexo"></a>搭建 Hexo</h1><ol>
<li>下载 <code>nodejs</code>  <a target="_blank" rel="noopener" href="https://link.segmentfault.com/?url=https://nodejs.org/zh-cn/">https://nodejs.org/zh-cn/</a></li>
<li>下载 <code>git</code> <a target="_blank" rel="noopener" href="https://link.segmentfault.com/?url=https://git-scm.com/">https://git-scm.com/</a></li>
</ol>
<h2 id="使用-npm-搭建"><a href="#使用-npm-搭建" class="headerlink" title="使用 npm 搭建"></a>使用 npm 搭建</h2><figure class="highlight sh"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 下载 hexo-cli</span></span><br><span class="line">npm install hexo-cli -g</span><br><span class="line"></span><br><span class="line"><span class="comment"># init hexo 项目</span></span><br><span class="line">hexo init</span><br><span class="line"></span><br><span class="line"><span class="comment"># 安装所有依赖</span></span><br><span class="line">npm install</span><br><span class="line"></span><br><span class="line"><span class="comment"># 清空已有 hexo 网站文件</span></span><br><span class="line">hexo clean </span><br><span class="line"></span><br><span class="line"><span class="comment"># 生成新网站文件: 依据网页html &amp; CSS样式</span></span><br><span class="line">hexo generate (or g) </span><br><span class="line"></span><br><span class="line"><span class="comment"># 启动本地服务器，可以在localhost:4000查看网站修改效果</span></span><br><span class="line">hexo server (or s) </span><br><span class="line"></span><br><span class="line"><span class="comment"># 下载 hexo-deploy-git 插件</span></span><br><span class="line">npm install --save hexo-deployer-git</span><br></pre></td></tr></table></figure>



<h2 id="配置-git-deploy"><a href="#配置-git-deploy" class="headerlink" title="配置 git deploy"></a>配置 git deploy</h2><p><code>_config.yml</code></p>
<figure class="highlight sh"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">deploy:</span><br><span class="line">  <span class="built_in">type</span>: git</span><br><span class="line">  repo: https://gitee.com/SolarisNeko/solarisneko.gitee.io.git</span><br><span class="line">  branch: main</span><br></pre></td></tr></table></figure>



<h2 id="deploy-到-Gitee"><a href="#deploy-到-Gitee" class="headerlink" title="deploy 到 Gitee"></a>deploy 到 Gitee</h2><figure class="highlight sh"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 重新生成文件</span></span><br><span class="line">hexo clean</span><br><span class="line"></span><br><span class="line">hexo generate</span><br><span class="line"></span><br><span class="line">hexo deploy</span><br></pre></td></tr></table></figure>





<h2 id="文件介绍"><a href="#文件介绍" class="headerlink" title="文件介绍"></a>文件介绍</h2><p>新建完成后，指定文件夹目录下有：</p>
<ul>
<li><code>node_modules</code>: 依赖包</li>
<li><code>public</code>：存放生成的页面</li>
<li><code>scaffolds</code>：生成文章的一些模板</li>
<li><code>source</code>：用来存放你的文章</li>
<li><code>themes</code>：主题</li>
<li><code> _config.yml</code>: 博客的配置文件</li>
</ul>

      
    </div>
    <footer class="article-footer">
      <a data-url="https://solarisneko.gitee.io/2021/08/26/SolarisNeko/" data-id="ckst2rcm70000v4wpfj175e2t" data-title="搭建 Hexo" class="article-share-link">Share</a>
      
      
      
    </footer>
  </div>
  
    
<nav id="article-nav">
  
    <a href="/2021/08/26/test/" id="article-nav-newer" class="article-nav-link-wrap">
      <strong class="article-nav-caption">Newer</strong>
      <div class="article-nav-title">
        
          test
        
      </div>
    </a>
  
  
    <a href="/2021/08/26/hello-world/" id="article-nav-older" class="article-nav-link-wrap">
      <strong class="article-nav-caption">Older</strong>
      <div class="article-nav-title">Hello World</div>
    </a>
  
</nav>

  
</article>


</section>
        
          <aside id="sidebar">
  
    

  
    

  
    
  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Archives</h3>
    <div class="widget">
      <ul class="archive-list"><li class="archive-list-item"><a class="archive-list-link" href="/archives/2021/08/">August 2021</a></li></ul>
    </div>
  </div>


  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Recent Posts</h3>
    <div class="widget">
      <ul>
        
          <li>
            <a href="/2021/08/26/test/">test</a>
          </li>
        
          <li>
            <a href="/2021/08/26/SolarisNeko/">搭建 Hexo</a>
          </li>
        
          <li>
            <a href="/2021/08/26/hello-world/">Hello World</a>
          </li>
        
      </ul>
    </div>
  </div>

  
</aside>
        
      </div>
      <footer id="footer">
  
  <div class="outer">
    <div id="footer-info" class="inner">
      
      &copy; 2021 SolarisNeko<br>
      Powered by <a href="https://hexo.io/" target="_blank">Hexo</a>
    </div>
  </div>
</footer>

    </div>
    <nav id="mobile-nav">
  
    <a href="/" class="mobile-nav-link">Home</a>
  
    <a href="/archives" class="mobile-nav-link">Archives</a>
  
</nav>
    


<script src="/js/jquery-3.4.1.min.js"></script>



  
<script src="/fancybox/jquery.fancybox.min.js"></script>




<script src="/js/script.js"></script>





  </div>
</body>
</html>